
#ifndef __UDBTABLESTYLE_H__
#define __UDBTABLESTYLE_H__

#pragma once

#include "zdbmain.h"

#include "zAdAChar.h"
#include "zAcValue.h"
#include "zAcString.h"
#include "zDbFormattedTableData.h"

#pragma pack (push, 8)

class UcDbTableTemplate;
class UcDbTableStyle : public UcDbObject
{
public:
    UCDB_DECLARE_MEMBERS(UcDbTableStyle);

    UcDbTableStyle();
    virtual ~UcDbTableStyle();

    virtual Ucad::ErrorStatus   getName(ZTCHAR*& pszName) const;
    virtual Ucad::ErrorStatus   setName(const ZTCHAR * pszName);

    virtual const ZTCHAR*        description(void) const;
    virtual Ucad::ErrorStatus   setDescription(const ZTCHAR * pszDescription);

    virtual ZSoft::UInt32       bitFlags() const;
    virtual Ucad::ErrorStatus   setBitFlags(ZSoft::UInt32 flags);

    virtual UcDb::FlowDirection flowDirection(void) const; 
    virtual Ucad::ErrorStatus   setFlowDirection(UcDb::FlowDirection flow);

    ZSOFT_DEPRECATED virtual double horzCellMargin(void) const;
    
    ZSOFT_DEPRECATED virtual Ucad::ErrorStatus setHorzCellMargin(double dCellMargin);

    ZSOFT_DEPRECATED virtual double vertCellMargin(void) const;
    
    ZSOFT_DEPRECATED virtual Ucad::ErrorStatus setVertCellMargin(double dCellMargin);

    ZSOFT_DEPRECATED virtual bool isTitleSuppressed(void) const;
    ZSOFT_DEPRECATED virtual Ucad::ErrorStatus suppressTitleRow(bool bValue);

    ZSOFT_DEPRECATED virtual bool isHeaderSuppressed(void) const;
    ZSOFT_DEPRECATED virtual Ucad::ErrorStatus suppressHeaderRow(bool bValue);

    virtual UcDbObjectId        textStyle(UcDb::RowType rowType = UcDb::kDataRow) const;
    virtual Ucad::ErrorStatus   setTextStyle(const UcDbObjectId id,
                                            int rowTypes = UcDb::kAllRows);
    
    virtual double              textHeight(UcDb::RowType rowType = UcDb::kDataRow) const;
    virtual Ucad::ErrorStatus   setTextHeight(double dHeight,
                                              int rowTypes = UcDb::kAllRows);

    virtual UcDb::CellAlignment alignment(UcDb::RowType rowType = UcDb::kDataRow) const;
    virtual Ucad::ErrorStatus   setAlignment(UcDb::CellAlignment alignment,
                                             int rowTypes = UcDb::kAllRows);

    virtual UcCmColor           color(UcDb::RowType rowType = UcDb::kDataRow) const;
    virtual Ucad::ErrorStatus   setColor(const UcCmColor& color,
                                         int rowTypes = UcDb::kAllRows);

    virtual UcCmColor           backgroundColor(UcDb::RowType rowType = UcDb::kDataRow) const;
    virtual Ucad::ErrorStatus   setBackgroundColor(const UcCmColor& color,
                                                   int rowTypes = UcDb::kAllRows);

    ZSOFT_DEPRECATED virtual bool isBackgroundColorNone(UcDb::RowType rowType = UcDb::kDataRow) const;
    ZSOFT_DEPRECATED virtual Ucad::ErrorStatus setBackgroundColorNone(bool bValue,
                                                       int rowTypes = UcDb::kAllRows);
	
    virtual Ucad::ErrorStatus   getDataType(UcValue::DataType& nDataType,
                                            UcValue::UnitType& nUnitType) const;
    
    ZSOFT_DEPRECATED virtual Ucad::ErrorStatus   getDataType(UcValue::DataType& nDataType,
                                            UcValue::UnitType& nUnitType,
                                            UcDb::RowType rowType) const;
    virtual Ucad::ErrorStatus   setDataType(UcValue::DataType nDataType,
                                            UcValue::UnitType nUnitType);
    
    ZSOFT_DEPRECATED virtual Ucad::ErrorStatus   setDataType(UcValue::DataType nDataType,
                                            UcValue::UnitType nUnitType,
                                            int rowTypes);

    ZSOFT_DEPRECATED virtual const ZTCHAR* format (void) const;
    
    ZSOFT_DEPRECATED virtual const ZTCHAR* format (UcDb::RowType rowType) const;
    
    ZSOFT_DEPRECATED virtual Ucad::ErrorStatus   setFormat(const ZTCHAR* pszFormat);
    
    ZSOFT_DEPRECATED virtual Ucad::ErrorStatus   setFormat(const ZTCHAR* pszFormat,
                                          int rowTypes);

    virtual UcDb::LineWeight    gridLineWeight(UcDb::GridLineType gridLineType, 
                                               UcDb::RowType rowType = UcDb::kDataRow) const;
    virtual Ucad::ErrorStatus   setGridLineWeight(UcDb::LineWeight lineWeight,
                                                  int gridLineTypes = UcDb::kAllGridLines, 
                                                  int rowTypes = UcDb::kAllRows);
    virtual UcCmColor           gridColor(UcDb::GridLineType gridLineType, 
                                          UcDb::RowType rowType = UcDb::kDataRow) const;
    virtual Ucad::ErrorStatus   setGridColor(const UcCmColor color,
                                             int gridLineTypes = UcDb::kAllGridLines, 
                                             int rowTypes = UcDb::kAllRows);
    virtual UcDb::Visibility    gridVisibility(UcDb::GridLineType gridLineType, 
                                               UcDb::RowType rowType = UcDb::kDataRow) const;
    virtual Ucad::ErrorStatus   setGridVisibility(UcDb::Visibility visible,
                                                  int gridLineTypes = UcDb::kAllGridLines, 
                                                  int rowTypes = UcDb::kAllRows);

    virtual Ucad::ErrorStatus   dwgInFields(UcDbDwgFiler* pFiler);
    virtual Ucad::ErrorStatus   dwgOutFields(UcDbDwgFiler* pFiler) const;
    virtual Ucad::ErrorStatus   dxfInFields(UcDbDxfFiler* pFiler);
    virtual Ucad::ErrorStatus   dxfOutFields(UcDbDxfFiler* pFiler) const;
	virtual Ucad::ErrorStatus	audit(UcDbAuditInfo* pAuditInfo);

    virtual Ucad::ErrorStatus   postTableStyleToDb(UcDbDatabase* pDb, 
                                                   const ZTCHAR* styleName, 
                                                   UcDbObjectId& tableStyleId);
    virtual Ucad::ErrorStatus   getClassID(CLSID* pClsid) const;
    const ZTCHAR *   createCellStyle         (void);
    Ucad::ErrorStatus createCellStyle       (const ZTCHAR* pszCellStyle);
    Ucad::ErrorStatus createCellStyle       (const ZTCHAR* pszCellStyle, 
                                             const ZTCHAR* pszFromCellStyle);
    Ucad::ErrorStatus renameCellStyle       (const ZTCHAR* pszOldName, 
                                             const ZTCHAR* pszNewName);
    Ucad::ErrorStatus deleteCellStyle       (const ZTCHAR* pszCellStyle);
    Ucad::ErrorStatus copyCellStyle         (const ZTCHAR* pszSrcCellStyle, 
                                             const ZTCHAR* pszTargetCellStyle);
    Ucad::ErrorStatus copyCellStyle         (const UcDbTableStyle* pSrc, 
                                             const ZTCHAR* pszSrcCellStyle,
                                             const ZTCHAR* pszTargetCellStyle);
    Ucad::ErrorStatus getUniqueCellStyleName(const ZTCHAR* pszBaseName, 
                                             UcString& sUniqueName) const;
    bool            isCellStyleInUse        (const ZTCHAR* pszCellStyle) const;
    int             numCellStyles           (void) const;
    int             getCellStyles           (UcStringArray& cellstyles) const;

    UcDbObjectId    textStyle               (const ZTCHAR* pszCellStyle) const;
    Ucad::ErrorStatus setTextStyle          (const UcDbObjectId& id, 
                                             const ZTCHAR* pszCellStyle);

    double          textHeight              (const ZTCHAR* pszCellStyle) const;
    Ucad::ErrorStatus setTextHeight         (double dHeight, 
                                             const ZTCHAR* pszCellStyle);

    UcDb::CellAlignment alignment           (const ZTCHAR* pszCellStyle) const;
    Ucad::ErrorStatus setAlignment          (UcDb::CellAlignment alignment, 
                                             const ZTCHAR* pszCellStyle);

    UcCmColor       color                   (const ZTCHAR* pszCellStyle) const;
    Ucad::ErrorStatus setColor              (const UcCmColor& color, 
                                             const ZTCHAR* pszCellStyle);

    UcCmColor       backgroundColor         (const ZTCHAR* pszCellStyle) const;
    Ucad::ErrorStatus setBackgroundColor    (const UcCmColor& color, 
                                             const ZTCHAR* pszCellStyle);

    Ucad::ErrorStatus getDataType           (UcValue::DataType& nDataType,
                                             UcValue::UnitType& nUnitType,
                                             const ZTCHAR* pszCellStyle) const;
    Ucad::ErrorStatus setDataType           (UcValue::DataType nDataType,
                                             UcValue::UnitType nUnitType,
                                             const ZTCHAR* pszCellStyle);

    const ZTCHAR *   format                  (const ZTCHAR* pszCellStyle) const;
    Ucad::ErrorStatus setFormat             (const ZTCHAR* pszFormat, 
                                             const ZTCHAR* pszCellStyle);

    int             cellClass               (const ZTCHAR* pszCellStyle) const;
    Ucad::ErrorStatus setCellClass          (int nClass, 
                                             const ZTCHAR* pszCellStyle);

    double          rotation                (const ZTCHAR* pszCellStyle) const;
    Ucad::ErrorStatus setRotation           (double fRotation, 
                                             const ZTCHAR* pszCellStyle);

    bool            isMergeAllEnabled       (const ZTCHAR* pszCellStyle) const;
    Ucad::ErrorStatus enableMergeAll        (bool bEnable, 
                                             const ZTCHAR* pszCellStyle);

    double          margin                  (UcDb::CellMargin nMargin,
                                             const ZTCHAR* pszCellStyle) const;
    Ucad::ErrorStatus setMargin             (UcDb::CellMargin nMargins, 
                                             double fMargin,
                                             const ZTCHAR* pszCellStyle);

    UcDb::LineWeight gridLineWeight         (UcDb::GridLineType gridLineType, 
                                             const ZTCHAR* pszCellStyle) const;
    Ucad::ErrorStatus setGridLineWeight     (UcDb::LineWeight lineWeight, 
                                             UcDb::GridLineType gridLineTypes, 
                                             const ZTCHAR* pszCellStyle);
    UcCmColor       gridColor               (UcDb::GridLineType gridLineType, 
                                             const ZTCHAR* pszCellStyle) const;
    Ucad::ErrorStatus setGridColor          (const UcCmColor color, 
                                             UcDb::GridLineType gridLineTypes, 
                                             const ZTCHAR* pszCellStyle);
    UcDb::Visibility gridVisibility         (UcDb::GridLineType gridLineType, 
                                             const ZTCHAR* pszCellStyle) const;
    Ucad::ErrorStatus setGridVisibility     (UcDb::Visibility visible, 
                                             UcDb::GridLineType gridLineTypes, 
                                             const ZTCHAR* pszCellStyle);
    double          gridDoubleLineSpacing   (UcDb::GridLineType gridLineType, 
                                             const ZTCHAR* pszCellStyle) const;
    Ucad::ErrorStatus setGridDoubleLineSpacing(double fSpacing, 
                                             UcDb::GridLineType gridLineTypes, 
                                             const ZTCHAR* pszCellStyle);
    UcDb::GridLineStyle gridLineStyle       (UcDb::GridLineType gridLineType, 
                                             const ZTCHAR* pszCellStyle) const;
    Ucad::ErrorStatus setGridLineStyle      (UcDb::GridLineStyle nLineStyle, 
                                             UcDb::GridLineType gridLineTypes, 
                                             const ZTCHAR* pszCellStyle);
    UcDbObjectId    gridLinetype            (UcDb::GridLineType gridLineType, 
                                             const ZTCHAR* pszCellStyle) const;
    Ucad::ErrorStatus setGridLinetype       (const UcDbObjectId& id, 
                                             UcDb::GridLineType gridLineTypes, 
                                             const ZTCHAR* pszCellStyle);
    Ucad::ErrorStatus getGridProperty       (UcGridProperty& gridProp, 
                                             UcDb::GridLineType nGridLineTypes, 
                                             const ZTCHAR* pszCellStyle) const;
    Ucad::ErrorStatus setGridProperty       (const UcGridProperty& gridProp, 
                                             UcDb::GridLineType nGridLineTypes, 
                                             const ZTCHAR* pszCellStyle);
    
    UcDbObjectId    getTemplate             (void) const;
    Ucad::ErrorStatus getTemplate           (UcDbTableTemplate*& pTemplate, 
                                             UcDb::OpenMode mode);
    Ucad::ErrorStatus setTemplate           (const UcDbObjectId& templateId, 
                                             UcDb::MergeCellStyleOption nOption);
    Ucad::ErrorStatus setTemplate           (UcDbTableTemplate* pTemplate, 
                                             UcDb::MergeCellStyleOption nOption,
                                             UcDbObjectId& templateId);
    UcDbObjectId    removeTemplate          (void);

	UcString cellStyleName( ZSoft::Int32 cellstyle )const;
};



#pragma pack (pop)

#endif 
